<?
session_start();
if(!session_is_registered("myusername")){
    header("location:index.php");
}
else{
}
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0.1//EN">
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=utf8"/>
        <title>Kartapuce - Projet BDD FPMs >> Aide</title>
        <link rel="stylesheet" href="./mystyle.css" type="text/css" media="screen" />
    </head>
    <body>
        <small>
            <b>Logged as:
                <?
                session_start();
                print $myusername;
                ?>
                <A HREF="./logout.php">Log out</A>

            </b>
        </small>

        <div id="conteneur" align="center" class="conteneur">
            <div align="center" class="conteneurdessus">
                <img src="img/banner.png" width="600" height="185" alt="banner" border="0"/>
            </div>
        </div>
        <center>
            <div id="conteneurdessus" align="center" class="conteneurdessus">
                <table border="0" cellspacing="10">
                    <td>
                        <A HREF="./boutique.php"><img src="img/boutique.png" width="138" height="39" alt="boutique" border="0"/>
                        </A>
                    </td>
                    <td>
                        <A HREF="./compte.php"><img src="img/compte.png" width="138" height="39" alt="compte" border="0"/>
                        </A>
                    </td>
                    <td>
                        <A HREF="./commandes.php"><img src="img/commandes.png" width="138" height="39" alt="commandes" border="0"/>
                        </A>
                    </td>
                    <td>
                        <A HREF="./panier.php"><img src="img/panier.png" width="138" height="39" alt="panier" border="0"/>
                        </A>
                    </td>
                    <td>
                        <A HREF="./accueil.php"><img src="img/accueil.png" width="138" height="39" alt="accueil" border="0"/>
                        </A>
                    </td>
                </table>

            </div>



            <div id='colonne1' align='left' class='colonnem'>
            <?
            include 'connect_db.php';

            $carte=$_GET['id'];
 
            echo '<br><dd><font face="New Century" size="5" color="black">&nbsp<u><b>Détails de la carte <i>'.$carte.'</i></b><br></u></font> ';


            $sql="SELECT * FROM db_cartes WHERE idcarte='".$carte."'";
            $result=mysql_query($sql);
            $row = mysql_fetch_row($result);
            $fini=$row[1];
            $desc=$row[2];
            $prix=$row[3];
            //Pour afficher du texte à la place du chiffre
            if($fini){
                $finitext="Oui";
            }
            else{
                $finitext="Non";
            }
            echo '<br><li type=circle><b>Produit fini?   </b><i>';
            echo $finitext;
            echo '</i><li type=circle><b>Prix indiqué: </b><i>';
            echo $prix;
            echo ' EUR</i><br><li type=circle><b>Description: </b><i>';
            echo $desc;
            echo '</i><br>';



            $sql1 = "SELECT db_composition.composants_idcomposants AS 'idc', db_composants.description_composant AS 'descc', db_composition.nombre AS 'nbc' FROM db_composition INNER JOIN db_composants ON idcomposants=composants_idcomposants WHERE db_composition.cartes_idcarte='".$carte."'";
       
            
            $res=mysql_query($sql1);
            echo '<br><TABLE BORDER=1>';
            echo '<TR><TD><b>ID composant</b></TD><TD><b>Description</b></TD><TD><b>Nombre</b></TD></TR>';
            while($tableau=mysql_fetch_array($res,MYSQL_ASSOC))
            {
                echo '<TR><TD>',$tableau['idc'],'</TD><TD>',$tableau['descc'],'</TD><TD>',$tableau['nbc'],'</TD></TR>';

            }



            echo '</TABLE>';        


   
       
            /*echo '<br><TABLE BORDER=1>';
            echo '<TR><TD><b>ID carte</b></TD><TD><b>Quantité</b></TD><TD><b>Prix unitaire</b></TD><TD><b>Sous total</b></TD><TD><b>Etat</b></TD></TR>';
            while($tableau=mysql_fetch_array($result,MYSQL_ASSOC))
            {
                echo '<TR><TD>',$tableau['id'],'</TD><TD>',$tableau['qty'],'</TD><TD>',$tableau['pu'],' EUR</TD><TD>',$tableau['pu']*$tableau['qty'],' EUR</TD><TD>',$tableau['etat'],'</TD></TR>';

            }
*/


            echo '</TABLE>';
          
            echo "</form>";

            echo '<br></dd>';


            echo '<dd><form><input type="button" value="Fermer détails" OnClick=window.close()></dd><br>';

            mysql_close($link);
            ?>
            </div>
        </center>
    </body>
</html>